package com.juma.cartridge.retryque;

import lombok.Getter;
import lombok.Setter;

/**
 * 	任务租约
 * @ClassName TaskLease
 * @Description
 * @Author zhuangguangyou
 * @Date 2019年6月18日 上午10:54:30
 * @Version 1.0
 *
 */

public class TaskLease {	
	
	@Setter @Getter private String servId;
	
	@Setter @Getter private String scanner;
	
	@Setter @Getter private long currentTime;
	
	@Setter @Getter private long leaseVal;
	
	@Setter @Getter private int count = 5;
	
	@Setter @Getter private long currentRound = 1;
	
	@Setter @Getter private String detail;
	
	
	public TaskLease() {
		currentTime = System.currentTimeMillis();
	}
	
	public static TaskLease of(String servId,String scanner,int seconds,long currentRound) {
		TaskLease tl = new TaskLease();
		tl.setServId(servId);
		tl.setScanner(scanner);
		tl.setLeaseVal(tl.getCurrentTime()+(seconds*1000));
		tl.setCurrentRound(currentRound);
		return tl;
	}
	
}
